home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Mania 5
/
MacMania 5.toast
/
/
Tools&Utilities
/
Plotfoil 3.2
/
naca-1.0
/
naca.f
< prev
next >
Wrap
Text File
|
1995-09-13
|
3KB
|
118 lines
c
c-----------------------------------------------------------------------------
c
c Naca.f -- generates a NACA foil section, printing the foil coordinates
c to stdout in a format usable by gnuplot.
c
c Written By: S.E.Norris
c
c norris@cfd.mech.unsw.edu.au
c
c $RCSfile: naca.f,v $
c $Author: norris $
c $Revision: 1.7 $
c $Date: 1995/08/31 11:05:52 $
c
c $Log: naca.f,v $
c Revision 1.7 1995/08/31 11:05:52 norris
c *** empty log message ***
c
c Revision 1.6 1995/08/31 07:30:19 norris
c Cleaned up code.
c
c Revision 1.5 1995/08/31 06:30:07 norris
c Removed an unwanted variable, scle.
c
c Revision 1.4 1995/08/31 04:43:30 norris
c Modified internal reads for the Cray cf77 compiler.
c
c Revision 1.3 1995/08/31 04:08:27 norris
c Corrected a bug in the naca utility -- return statement instead of exit().
c
c Revision 1.2 1995/08/31 02:20:00 norris
c Check command line args to see that numbers are entred.
c
c Revision 1.1 1995/08/31 02:03:05 norris
c Initial revision
c
c-----------------------------------------------------------------------------
c
c
IMPLICIT none
INTEGER npl ! Number of points on foil
INTEGER npmx ! Size of points array
PARAMETER (npmx=500)
INTEGER inaca ! Returns Foil thickness
INTEGER nmn ! Returns increase in length of name
REAL x(3,npmx) ! Returns Array of points on foil
REAL scle ! Length of foil
CHARACTER naca*(20) ! String containing NACA number
LOGICAL t_n ! Returns if foil created
INTEGER i
INTEGER ierr
CHARACTER buff*(10)
c
INTEGER Iargc,Lnblnk
LOGICAL Digit
EXTERNAL Iargc,Getarg ! UNIX library functions
EXTERNAL Digit,Lnblnk
c
DATA scle / 1.0 /
c
c Check for correct number of command line args
c
if (Iargc().ne.2 .or. naca(1:2).eq.'-h') call Error()
c
c Get command line args
c
call Getarg(1,naca)
call Getarg(2,buff)
if (.not.Digit(buff,Lnblnk(buff))) call Error()
read(buff,'(i10)',iostat=ierr) npl
if (ierr.ne.0) call Error()
c
c Check size of arrays
c
if (npl.ge.npmx) then
print '(a,i5)', 'naca: Maximum number of points is ',npmx
call exit(1)
stop
endif
c
c Generate foil
c
call NacaFoil( x,npl,npmx,naca,scle,inaca,t_n,nmn )
c
c Check that we could create the foil
c
if (.not. t_n) then
print '(3a)', 'naca: Could not create the ',
& naca(1:Lnblnk(naca)),' section'
call exit(1)
stop
endif
c
c Print out the foil to stdout
c
print '(2a)', '# NACA ',naca(1:Lnblnk(naca))
do i = 1,npl+1
print '(g20.10,1x,g20.10)', x(1,i),x(2,i)
enddo
c
call exit(0)
stop
END
c
c-----------------------------------------------------------------------------
c
SUBROUTINE Error()
c
print '(a)', 'Usage: naca NACA_Number Number_of_points'
call exit(1)
stop
END